import { dayjs } from "@/main.js";
var mixins = {
    created() {},
    mounted() {},
    data() {
        return {};
    },
    methods: {
		valid() {
            return new Promise(async (resolve) => {
                let result = true;
                let refs = Object.values(this.$refs);
                for (let index = 0; index < refs?.length; index++) {
                    const ref = refs[index];
                    if (
                        Object.prototype.toString.call(ref) == "[object Array]"
                    ) {
                        for (let i = 0; i < ref.length; i++) {
                            const element = ref[i];
                            if (element?.valid) {
                                let rc = await element?.valid?.();
                                result = result && rc;
                            }
                            if (element?.validate) {
                                let rf = await this._valid(ref);
                                result = result && rf;
                            }
                            if (element?.form_validate) {
                                let rf = await this._valid(
                                    ref,
                                    "form_validate"
                                );
                                result = result && rf;
                            }
                        }
                    } else {
                        if (ref?.valid) {
                            let rc = await ref?.valid?.();
                            result = result && rc;
                        }
                        if (ref?.validate) {
                            let rf = await this._valid(ref);
                            result = result && rf;
                        }
                        if (ref?.form_validate) {
                            let rf = await this._valid(ref, "form_validate");
                            result = result && rf;
                        }
                    }
                }

                resolve(result);
            });
        },
       
    },
    computed: {},
    filters: {
       
    },
};

export default mixins;
